<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {
    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,tokens,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        $result = [
            'code' => 1,
            'msg'  => '接口错误',
            'time' => time(),
            'data' => [],
        ];
        return json($result);
        exit();
    });
    Route::group('User', function () {
        Route::post('login', '/login'); //登录
        Route::rule('getaddress', '/getaddress'); //地址管理
        Route::rule('shoplist', '/shoplist'); //店铺列表
        Route::post('shoplist_del', '/shoplist_del'); //店铺列表
        Route::post('opend', '/opend'); //店铺列表
        Route::get('other', '/other'); //店铺参数
        Route::rule('addshop', '/addshop'); //业务经理操作店铺
        Route::rule('addshop2', '/addshop2'); //督导操作店铺
        Route::rule('addshop3', '/addshop3'); //督导操作店铺
        Route::rule('shoplists', '/shoplists'); //店铺列表
        Route::get('getlatlon', '/getlatlon'); //店铺列表
    })->prefix('User');
    Route::group('Task', function () {
        Route::post('login', '/login'); //登录
        Route::post('savexcxopen', '/savexcxopen'); //登录
        Route::get('getlatlon', '/getlatlon'); //定位坐标集
        Route::rule('getaddress', '/getaddress'); //附近商家
        Route::rule('getaddress2', '/getaddress2'); //附近商家
        Route::rule('getaddress3', '/getaddress3'); //附近商家
        Route::get('getinfo', '/getinfo'); //个人信息
        Route::get('orderlists', '/orderlists'); //订单大厅
        Route::get('other', '/other'); //其他数据
        Route::post('addDispatch', '/addDispatch'); //业务经理提交派单
        Route::post('addyDispatch', '/addyDispatch'); //业务经理提交派单
        Route::post('addDispatch2', '/addDispatch2'); //售后经理提交派单
        Route::post('addDispatch3', '/addDispatch3'); //管理提交派单
        Route::get('getdetail', '/getdetail'); //获取订单详情
        Route::post('superStatus', '/superStatus'); //管理员指派开业督导
        Route::post('addxuanzhi', '/addxuanzhi'); //选址完成
        Route::post('addshouhou', '/addshouhou'); //售后完成
        Route::post('addkaiye', '/addkaiye'); //开业完成
        Route::rule('reimburs', '/reimburs'); //报销
        Route::post('reimburstatus', '/reimburstatus'); //报销
        Route::get('getuseraut', '/getuseraut'); //获取骑手位置信息
        Route::post('addkaioran', '/addkaioran'); //售后安装或开业
        Route::post('addkaioran2', '/addkaioran2'); //派单员安装或开业
        Route::post('addxunorhui', '/addxunorhui'); //售后安装或开业
        Route::post('addxunorhui2', '/addxunorhui2'); //派单员安装或开业
        Route::post('getzhiding', '/getzhiding'); //置顶
        Route::get('getdingyue', '/getdingyue'); //消息订阅
        Route::rule('addmark', '/addmark'); //置顶
        Route::get('getbiaoji', '/getbiaoji'); //置顶
        Route::get('addtags', '/addtags'); //置顶
        Route::get('deltag', '/deltag'); //置顶
        Route::get('getmark', '/getmark'); //置顶
        Route::get('delmark', '/delmark'); //置顶
        Route::rule('kaoqin', '/kaoqin'); //置顶
        Route::rule('postkaoqin', '/postkaoqin'); //置顶
        Route::rule('postsqkaoqin', '/postsqkaoqin'); //置顶
        Route::get('getsigndata', '/getsigndata'); //置顶
        Route::get('usersigndetailall', '/usersigndetailall'); //置顶
        Route::rule('dingzhuanxuan', '/dingzhuanxuan'); //置顶
        Route::rule('bxlist', '/bxlist'); //置顶
        Route::rule('dingorxuan', '/dingorxuan'); //置顶
        Route::rule('postsignstatus', '/postsignstatus'); //置顶
        Route::rule('myleave', '/myleave'); //置顶
        Route::rule('leavelist', '/leavelist'); //置顶
        Route::rule('annous', '/annous'); //置顶
        Route::rule('liaotian', '/liaotian'); //置顶
        Route::rule('getreads', '/getreads'); //置顶
        Route::post('addxuanzhi_new', '/addxuanzhi_new'); //选址完成
        Route::get('sucai', '/sucai'); //选址完成\
        Route::rule('pinfen', '/pinfen'); //选址完成saveFile
        Route::rule('savezhaopai', '/savezhaopai');
        Route::rule('saveFile', '/saveFile');
        Route::post('userstatus', '/userstatus'); //选址完成
        Route::get('getdaidan', '/getdaidan'); //选址完成\
        Route::rule('superannous', '/superannous'); //选址完成\
        Route::get('getannous', '/getannous'); //选址完成\
        Route::rule('signexcel', '/signexcel'); //选址完成\
        Route::rule('addmarks', '/addmarks'); //选址完成\
        Route::rule('marklist', '/marklist'); //选址完成\
        Route::rule('upaddress', '/upaddress'); //选址完成\
    })->prefix('Task');
    //小程序接口
    Route::group('Other', function () {
        Route::get('others', '/others'); //登录
        Route::post('oss', '/oss'); //登录
        Route::get('getoss', '/getoss'); //登录
        Route::get('addressjson', '/addressjson'); //登录
        Route::get('getstreet', '/getstreet'); //登录
        Route::rule('getopenid', '/getopenid');
        Route::rule('orderlists', '/orderlists');
    })->prefix('Other');
})->bind('api')->prefix('api');
